import React, { Component } from 'react';
// 导入路由
import { Router, Route, Switch } from 'react-router-dom';

// 导入页面组件
import Login from './pages/Login';
import Layout from './pages/Layout';
import Test from './pages/Test';
import AuthRoute from './components/AuthRoute';
import history from './utils/history';

// 配置路由规则
export default class App extends Component {
  render() {
    return (
      // 手动组装 BrowserRouter 使用Router组件加history自行组装
      <Router history={history}>
        {/* 路由规则 */}
        <Switch>
          <Route path="/login" component={Login}></Route>
          {/* 1. 准备测试页面和测试路由 */}
          <Route path="/test" component={Test}></Route>
          <AuthRoute path="/" component={Layout}></AuthRoute>
        </Switch>
      </Router>
    );
  }
}
